﻿#pragma once

#include <map>
#include "common.h"
#include "ui/controls.h"
#include "editor/settings.h"

namespace anip
{
	namespace editor
	{
		namespace drawing
		{
			class Tool;
		}

		class InspectorContentProvider
		{
			friend class Inspector;

		public:
			virtual wstring name() const = 0;

		protected:
			bool tellInspectorAddContent();
			bool tellInspectorRemoveContent();

			virtual void processCreateUI(ui::Container& c) = 0;
			virtual void processDeleteUI(ui::Container& c) = 0;
		};

		class Inspector : public EditorWindow
		{
			friend class InspectorContentProvider;

		private:
			std::map<InspectorContentProvider*, ui::FoldablePanel*> _panels;

			void _addContent(InspectorContentProvider& p);
			void _removeContent(InspectorContentProvider& p);

			bool _hasContent(InspectorContentProvider& p) const
			{
				return _panels.find(&p) != _panels.end();
			}

		protected:
			void processMarkedDelete() override;

		public:
			Inspector(Container* parent);
		};
	}
}